<%--
  Created by IntelliJ IDEA.
  User: 唐东
  Date: 2021/1/21
  Time: 0:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>我的购物车</title>
</head>
<body bgcolor="pink">
<h2 align="center">确认订单</h2>
<hr>
<form method="post" action="/insertOrdersServlet">
    <table  width="650" align="center" class="border_distance" bgcolor="white">
        <thead>
        <tr bgcolor="#DB7093">
            <td align="center" width="80">商品名称</td>
            <td align="center">商品单价</td>
            <td align="center" width="100">购买数量</td>
            <td align="center" width="100">金额</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.orders}" var="order" varStatus="id" >
                <tr>
                    <td align="center">${order.bookName}</td>
                    <td align="center">${order.price}</td>
                    <td align="center">${order.num}</td>
                    <td align="center">${order.totalPrice}</td>
                    <c:set var="allPrice" value="${allPrice+order.totalPrice}"></c:set>
                </tr>
            </c:forEach>
            <tr align="center">
                <td colspan="5">
                    总计：<input type="text" name="allPrice" value="${allPrice}" readonly>
                </td>
            </tr>
            <tr align="center">
                <td colspan="5">
                    收获地址：<input type="text" name="address">
                </td>
            </tr>
            <tr align="center">
                <td colspan="5">
                    <a href="/listUserHomeServlet">继续购买</a>
                    <a href="/listCartServlet">返回购物车</a>
                    <input type="submit" value="确认购买">
                </td>
            </tr>
        </tbody>
    </table>
</form>
<br>
</body>
</html>
